﻿/*------------------------------------------------
// File Description: Machine DataBase Entity
// Author:			 汪亮
// Create Time:		 2020-03-07 01:50:59
//------------------------------------------------*/

using System;
using System.Data.Entity;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace IOA.MES.DataAccess.Entity
{
    /// <summary>
    /// 设备表
    /// </summary>
    [Table(nameof(Machine))]
    public class Machine : BaseEntity
    {
        private string _machineName = string.Empty;
        private string _settings = string.Empty;
        private string _machineModel;
        private string _manufacturers;
        private string _workshopCode;
        private string _workshopName;
        private string _machineNo;
        private string _ipHost;
        private string _lineName;
        private string _ivStandardPieceCode;

        #region Public Property

        ///<Summary>
        /// 设备类型
        ///</Summary>
        public Enum.MachineType MachineType { get; set; }

        ///<Summary>
        /// 设备代码
        ///</Summary>
        public string MachineNo
        {
            get { return string.IsNullOrWhiteSpace(_machineNo) ? string.Empty : _machineNo; }
            set { _machineNo = value; }
        }

        ///<Summary>
        /// 设备名称
        ///</Summary>
        public string MachineName
        {
            get { return string.IsNullOrWhiteSpace(_machineName) ? string.Empty : _machineName; }
            set { _machineName = value; }
        }

        ///<Summary>
        /// 设备厂家
        ///</Summary>
        public string Manufacturers
        {
            get { return string.IsNullOrWhiteSpace(_manufacturers) ? string.Empty : _manufacturers; }
            set { _manufacturers = value; }
        }

        ///<Summary>
        /// 设备型号
        ///</Summary>
        public string MachineModel
        {
            get { return string.IsNullOrWhiteSpace(_machineModel) ? string.Empty : _machineModel; }
            set { _machineModel = value; }
        }

        ///<Summary>
        /// 车间代码
        ///</Summary>
        public string WorkshopCode
        {
            get { return string.IsNullOrWhiteSpace(_workshopCode) ? string.Empty : _workshopCode; }
            set { _workshopCode = value; }
        }

        ///<Summary>
        /// 车间名称
        ///</Summary>
        public string WorkshopName
        {
            get { return string.IsNullOrWhiteSpace(_workshopName) ? string.Empty : _workshopName; }
            set { _workshopName = value; }
        }

        ///<Summary>
        /// 流水线ID
        ///</Summary>
        public int LineId { get; set; }

        ///<Summary>
        /// 流水线名称
        ///</Summary>
        public string LineName
        {
            get { return string.IsNullOrWhiteSpace(_lineName) ? string.Empty : _lineName; }
            set { _lineName = value; }
        }

        ///<Summary>
        /// 参数配置
        ///</Summary>
        public string Settings
        {
            get { return string.IsNullOrWhiteSpace(_settings) ? string.Empty : _settings; }
            set { _settings = value; }
        }

        ///<Summary>
        /// IP地址
        ///</Summary>
        public string IpHost
        {
            get { return string.IsNullOrWhiteSpace(_ipHost) ? string.Empty : _ipHost; }
            set { _ipHost = value; }
        }

        /// <summary>
        /// 车间内序号
        /// </summary>
        public int? MachineIndex { get; set; }

        ///<Summary>
        /// 状态
        ///</Summary>
        public Enum.CommonStatus Status { get; set; }

        ///<Summary>
        /// IV标片条码
        ///</Summary>
        public string IvStandardPieceCode
        {
            get { return string.IsNullOrWhiteSpace(_ivStandardPieceCode) ? string.Empty : _ivStandardPieceCode; }
            set { _ivStandardPieceCode = value; }
        }

        /// <summary>
        /// IV标片测试结果
        /// </summary>
        public bool? IvStandardPieceTestResult { get; set; }

        /// <summary>
        /// 上次测试时间
        /// </summary>
        public DateTime? IvStandardPieceLastTime { get; set; }
        #endregion
    }

    public partial class MESContext
    {
        /// <summary>
        /// 设备表
        /// </summary>
        public virtual DbSet<Machine> Machines { get; set; }
    }
}